<%--
  Created by IntelliJ IDEA.
  User: 1234
  Date: 2018/4/22
  Time: 17:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
</head>
<body>
区域添加测试（test）
<hr>
<form action="/area" method="post">
    父级： <input type="text" name="parent">
    名字： <input type="text" name="name">
    type:<input type="text" name="type">
    <input type="submit" value="提叫">
</form>
多个区域删除测试
<hr>
<button class="deletes">删除多个</button>

<br>
单个区域删除测试
<hr>
<button class="delete">删除单个</button>

<br>
添加一个或多个区域关联测试
<hr>
<button class="insertU">添加关联</button>


<br>
删除一个或多个区域关联测试
<hr>
<button class="dU">删除关联</button>
<hr>
<br>
<br>
<br>
<br>
<br>
<br>
<hr>
用户添加测试
<form action="/user" method="post">
    用户名： <input type="text" name="username"><br>
    身份证： <input type="text" name="card"><br>
    手机号:<input type="text" name="tel"><br>
    学习科目;<input type="text" name="studysub"><br>
    用户地址:<input type="text" name="place"><br>
    缴纳学费:<input type="text" name="money"><br>
    驾校名称:<input type="text" name="drivename"><br>
    使用期限:<input type="text" name="timelimit"><br>
    民族：汉<input type="checkbox" name="race" value="1" checked="checked"/>
    藏<input type="checkbox" name="race" value="2"/><br>
    <input type="submit" value="提叫">
</form>


<br>
<hr>
获取用户关联的权限测试<br>
<button class="getQu">获取用户关联权限</button>


<br>

<form action="/course" method="post" enctype="multipart/form-data">
    刷穿文件：<input type="file" name="courseImg">
    <input type="submit" value="提叫">
</form>

<br>

<br>
测试<br>
<button class="sssss">关联权限</button>


<br>

<form action="/subject/fix" method="post" enctype="multipart/form-data">
    <input type="text" name="problem">
    刷穿文件：<input type="file" name="readfile">
    刷穿文件：<input type="file" name="zreadfile">
    <input type="submit" value="跳啊啊">
</form>

</body>
</html>
<script>
    (function () {
        $(".getQu11").click(function () {
            $.ajax({
                url: '/subject',
                type: 'POST',
                data: {
                    type: 2,
                    htmla: '发士大夫撒旦'
                },
                success: function (result) {
                    // Do something with the result
                }
            });

        });

        $(".deletes").click(function () {
            console.info("我被点击了");
            var ids = [];
            ids.push(3);
//            ids.push(5);
            console.info(JSON.stringify(ids));
            $.ajax({
                // contentType必须添加
                contentType: 'application/json;charset=UTF-8',
                type: 'DELETE',
                dataType: "json",
                data: JSON.stringify(ids),
                url: '/areas',
                success: function (result) {
                }
            });
        });

        $(".delete").click(function () {
            $.ajax({
                url: '/area',
                type: 'POST',
                data: {
                    id: 9,
                    _method: 'DELETE'
                },
                success: function (result) {
                    // Do something with the result
                }
            });

        });

        $(".insertU").click(function () {
            console.info("我被点击了");
            var userIds = [];
            userIds.push({aid: 1, uid: 1});
            userIds.push({aid: 1, uid: 2});
            console.info(JSON.stringify(userIds));
            $.ajax({
                // contentType必须添加
                contentType: 'application/json;charset=UTF-8',
                type: 'POST',
                dataType: "json",
                data: JSON.stringify(userIds),
                url: '/area/relateUser',
                success: function (result) {

                }
            });
        });
        $(".dU").click(function () {
            console.info("我被点击了");
            var auserIds = [];
            auserIds.push(1);
            auserIds.push(2);
            console.info(JSON.stringify(auserIds));
            $.ajax({
                // contentType必须添加
                contentType: 'application/json;charset=UTF-8',
                type: 'DELETE',
                dataType: "json",
                data: JSON.stringify(auserIds),
                url: '/area/deleteUser',
                success: function (result) {

                }
            });
        });


        $(".getQu").click(function () {
            console.info("我被点击了");
            $.ajax({
                type: 'GET',
                dataType: "json",
                data: {id: 613},
                url: '/level',
                success: function (result) {
                    console.info(result);

                }
            });
        });

        $(".sssss").click(function () {
            console.info("我被点击了");
            var sss = new Object();
            var auserIds=[];
            auserIds.push(1);
            auserIds.push(2);
            sss.ids=auserIds;
            var ss1=[];
           var te= new Object();
            te.type = 1;
            te.lid = 2;
            var te1= new Object();
            te1.type = 432;
            te1.lid = 231;
            ss1.push(te);
            ss1.push(te1);
            sss.levels=ss1;
            $.ajax({
                contentType:'application/json;charset=UTF-8',
                type: 'PUT',
                dataType: "json",
                data:JSON.stringify(sss),
                url: '/level',
                success:function(result){
                    console.info(result);
                }});
        });




    })();
</script>

